package com.theme.passport.controller.theme;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.theme.common.mvc.utils.PageUtils;
import com.theme.common.mvc.utils.Query;
import com.theme.common.mvc.view.R;
import com.theme.passport.dao.theme.TabActivationCodeDao;
import com.theme.passport.entity.UserEntity;
import com.theme.passport.entity.constant.UserReviewStatusEnum;
import com.theme.passport.entity.theme.TabActivationCode;
import com.theme.passport.service.TabActivationCodeService;
import com.theme.passport.service.UserService;
import org.apache.commons.lang.StringUtils;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.Date;
import java.util.Map;

@RestController
@RequestMapping("theme/tabActivationCode")
public class TabActivationCodeController {

    @Autowired
    private TabActivationCodeService service;

    /**
     * 获取列表
     */
    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params) {
        PageUtils page = service.queryPage(params);
        return R.ok().put("page", page);
    }

    /**
     * 生成激活码
     */

    @RequestMapping("/gen")
    public R gen() {
        String code = service.gen();
        return R.ok(code);
    }

    /**
     * 作废激活码
     */
    @RequestMapping("/zf")
    public R zf(@RequestParam Map<String, Object> params) {
        String idStr = (String) params.get("id");
        service.zf(Integer.parseInt(idStr));
        return R.ok();
    }




}